NPM安装不断抛出错误

时间:2019-02-18 09:03:38

标签: javascript node.js reactjs npm react-dropzone

我是一位反应灵敏的初学者,试图弄清楚如何构建组件,但是在尝试遵循本教程时,我的页面无法运行。 https://www.youtube.com/watch?v=aK3aUW08YGw&list=PLEsfXFp6DpzQbwYDx1zgcKJ4tzyWFaESK&index=25When我尝试npm install dropzone,我收到了大量错误消息。然后,当我键入npm list dropzone时,树显示为空。这是错误日志:

adampease-> npm install --save react-dropzone

> fsevents@1.2.4 install /Users/adampease/Desktop/projects/resize/node_modules/react-scripts/node_modules/fsevents
> node install

node-pre-gyp WARN Tried to download(404): https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.2.4/fse-v1.2.4-node-v67-darwin-x64.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for fsevents@1.2.4 and node@11.10.0 (node-v67 ABI, unknown) (falling back to source compile with node-gyp) 
gyp ERR! configure error 
gyp ERR! stack Error: Command failed: /anaconda3/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack 
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:297:12)
gyp ERR! stack     at ChildProcess.emit (events.js:197:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:984:16)
gyp ERR! stack     at Socket.stream.socket.on (internal/child_process.js:401:11)
gyp ERR! stack     at Socket.emit (events.js:197:13)
gyp ERR! stack     at Pipe._handle.close (net.js:611:12)
gyp ERR! System Darwin 16.3.0
gyp ERR! command "/Users/adampease/.nvm/versions/node/v11.10.0/bin/node" "/Users/adampease/.nvm/versions/node/v11.10.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/adampease/Desktop/projects/resize/node_modules/react-scripts/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node" "--module_name=fse" "--module_path=/Users/adampease/Desktop/projects/resize/node_modules/react-scripts/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64" "--napi_version=4" "--node_abi_napi=napi"
gyp ERR! cwd /Users/adampease/Desktop/projects/resize/node_modules/react-scripts/node_modules/fsevents
gyp ERR! node -v v11.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/Users/adampease/.nvm/versions/node/v11.10.0/bin/node /Users/adampease/.nvm/versions/node/v11.10.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/adampease/Desktop/projects/resize/node_modules/react-scripts/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node --module_name=fse --module_path=/Users/adampease/Desktop/projects/resize/node_modules/react-scripts/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64 --napi_version=4 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/adampease/Desktop/projects/resize/node_modules/react-scripts/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:197:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:984:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
node-pre-gyp ERR! System Darwin 16.3.0
node-pre-gyp ERR! command "/Users/adampease/.nvm/versions/node/v11.10.0/bin/node" "/Users/adampease/Desktop/projects/resize/node_modules/react-scripts/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/adampease/Desktop/projects/resize/node_modules/react-scripts/node_modules/fsevents
node-pre-gyp ERR! node -v v11.10.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.0
node-pre-gyp ERR! not ok 
Failed to execute '/Users/adampease/.nvm/versions/node/v11.10.0/bin/node /Users/adampease/.nvm/versions/node/v11.10.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/adampease/Desktop/projects/resize/node_modules/react-scripts/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node --module_name=fse --module_path=/Users/adampease/Desktop/projects/resize/node_modules/react-scripts/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64 --napi_version=4 --node_abi_napi=napi' (1)
npm WARN ts-pnp@1.0.0 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/react-scripts/node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 install: `node install`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ react-dropzone@8.1.0
updated 1 package and audited 36308 packages in 22.039s
found 63 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details

1 个答案:

答案 0 :(得分:0)

由于在计算机上安装了Python 3.0,因此遇到了这些问题。我将其降级为Python 2.7,并且可以正常工作。