错误:<项目文件夹路径//node_modules/@ babel/helper-compilation-targets的程序包导出未定义“.".子路径 [英] Error: Package exports for <path to project folder>/node_modules/@babel/helper-compilation-targets' do not define a '.' subpath
问题描述
我刚刚创建了一个新的项目文件夹,并运行了以下命令:
I just created a new project folder and ran the following commands:
- npm初始化
- npm install express
- npm install express-react-views反应 react-dom
- npm init
- npm install express
- npm install express-react-views react react-dom
创建了带有快速导入的index.js和一个示例jsx文件的视图.在本地主机上运行时,出现此错误:
Created index.js with express imported and views for a sample jsx file. When I run on localhost, I get this error:
Error: Package exports for '<path_to_project_folder>/node_modules/@babel/helper-compilation-targets' do not define a '.' subpath
at applyExports (internal/modules/cjs/loader.js:485:15)
at resolveExports (internal/modules/cjs/loader.js:508:12)
at Function.Module._findPath (internal/modules/cjs/loader.js:577:20)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:879:27)
at Function.Module._load (internal/modules/cjs/loader.js:785:27)
at Module.require (internal/modules/cjs/loader.js:956:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (<path_to_project_folder>/node_modules/@babel/preset-env/lib/debug.js:8:33)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Module._compile (<path_to_project_folder>/node_modules/pirates/lib/index.js:99:24)
2019年10月,我使用相同的步骤创建了一个快速应用程序,发现没有这样的程序包(@ babel/helper-compilation-targets),并且运行良好.
In Oct 2019, I created an express app using the same steps ran, and found there is no such package (@babel/helper-compilation-targets), and it ran fine.
我不确定这是怎么回事.有人可以提供建议吗? 谢谢!
I'm not sure what is wrong. Can anyone help to advice? Thank you!
推荐答案
出现了同样的问题.更新node.js可以解决我的问题
Had the same issue. Updating the node.js fixed that for me
这篇关于错误:<项目文件夹路径//node_modules/@ babel/helper-compilation-targets的程序包导出未定义“.".子路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!