新安装的用于更改节点模块的包
Newly installed package for react changing the node modules
我正在完成一个项目,我是 React 的新手。
我试图安装一个名为 react-toastify 的新包,但我正在创建的几乎完成的项目突然向我显示此错误:
./node_modules/react/index.js
Module build failed: Error: ENOENT: no such file or directory, open
'/Users/mynamehere/react/projectnamehere/frontend/node_modules/react/index.js'
当我检查提到的目录时,文件确实不存在。但这是有效的,因为我在这个项目上工作了很长时间。
我尝试使用 npm install
重新安装所有内容,但无济于事。
这是我在第一次出现错误时从 .npm/_logs
中提取的初始日志。
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm@5.0.0
3 info using node@v8.0.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle frontend@0.1.0~prestart: frontend@0.1.0
6 silly lifecycle frontend@0.1.0~prestart: no script for prestart, continuing
7 info lifecycle frontend@0.1.0~start: frontend@0.1.0
8 verbose lifecycle frontend@0.1.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle frontend@0.1.0~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/edper/react/readable-redux/frontend/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/share/dotnet:/usr/local/go/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
10 verbose lifecycle frontend@0.1.0~start: CWD: /Users/edper/react/readable-redux/frontend
11 silly lifecycle frontend@0.1.0~start: Args: [ '-c', 'react-scripts start' ]
12 error cb() never called!
13 error This is an error with npm itself. Please report this error at:
14 error <https://github.com/npm/npm/issues>
我尝试按照下面的建议删除 node_modules
目录,但我得到了与上次相同的错误,如下所示:
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! frontend@0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the frontend@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
当您更新 Node 版本时,某些功能可能已被弃用。每当有主要节点发布时,您应该始终尝试用它更新所有节点模块。
要检查过时的节点模块,您可以使用 npm outdated
要解决此问题,您可以删除所有节点模块。
命中npm outdated
使用所有可用的最新模块版本更新您的 package.json。
然后点击 npm install
但一定要检查模块更改日志,看看所有的更改。
如果有重大更改,它也可能会影响您的应用程序的工作。
我正在完成一个项目,我是 React 的新手。
我试图安装一个名为 react-toastify 的新包,但我正在创建的几乎完成的项目突然向我显示此错误:
./node_modules/react/index.js
Module build failed: Error: ENOENT: no such file or directory, open
'/Users/mynamehere/react/projectnamehere/frontend/node_modules/react/index.js'
当我检查提到的目录时,文件确实不存在。但这是有效的,因为我在这个项目上工作了很长时间。
我尝试使用 npm install
重新安装所有内容,但无济于事。
这是我在第一次出现错误时从 .npm/_logs
中提取的初始日志。
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm@5.0.0
3 info using node@v8.0.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle frontend@0.1.0~prestart: frontend@0.1.0
6 silly lifecycle frontend@0.1.0~prestart: no script for prestart, continuing
7 info lifecycle frontend@0.1.0~start: frontend@0.1.0
8 verbose lifecycle frontend@0.1.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle frontend@0.1.0~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/edper/react/readable-redux/frontend/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/share/dotnet:/usr/local/go/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
10 verbose lifecycle frontend@0.1.0~start: CWD: /Users/edper/react/readable-redux/frontend
11 silly lifecycle frontend@0.1.0~start: Args: [ '-c', 'react-scripts start' ]
12 error cb() never called!
13 error This is an error with npm itself. Please report this error at:
14 error <https://github.com/npm/npm/issues>
我尝试按照下面的建议删除 node_modules
目录,但我得到了与上次相同的错误,如下所示:
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! frontend@0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the frontend@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
当您更新 Node 版本时,某些功能可能已被弃用。每当有主要节点发布时,您应该始终尝试用它更新所有节点模块。
要检查过时的节点模块,您可以使用 npm outdated
要解决此问题,您可以删除所有节点模块。
命中npm outdated
使用所有可用的最新模块版本更新您的 package.json。
然后点击 npm install
但一定要检查模块更改日志,看看所有的更改。 如果有重大更改,它也可能会影响您的应用程序的工作。