我在执行npm start
时遇到此错误:
PS C:\Users\Concierge\downloads\prod\pdf2\ipfs_image_uploader> npm start
> react-box@0.1.0 start C:\Users\Concierge\downloads\prod\pdf2\ipfs_image_uploader
> node scripts/start.js
internal/modules/cjs/loader.js:582
throw err;
^
Error: Cannot find module 'dotenv'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
at Function.Module._load (internal/modules/cjs/loader.js:506:25)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (C:\Users\Concierge\downloads\prod\pdf2\ipfs_image_uploader\scripts\
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-box@0.1.0 start: `node scripts/start.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-box@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output ab
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Concierge\AppData\Roaming\npm-cache\_logs\2018-11-17T04_27_59_461Z-debug
PS C:\Users\Concierge\downloads\prod\pdf2\ipfs_image_uploader>
,当我运行命令npm install
时,出现此错误:
> scrypt@6.0.3 preinstall /Users/user/Documents/pdfuploader/node_modules/scrypt
> node node-scrypt-preinstall.js
> scrypt@6.0.3 install /Users/user/Documents/pdfuploader/node_modules/scrypt
> node-gyp rebuild
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "/path/to/executable/python2.7", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Darwin 17.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/user/Documents/pdfuploader/node_modules/scrypt
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! scrypt@6.0.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scrypt@6.0.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/user/.npm/_logs/2018-11-18T05_45_00_864Z-debug.log`
我试图像下面这样设置pythonpath:https://www.tutorialspoint.com/How-to-set-your-python-path-on-Mac,但没有帮助
我只是通过使用本教程来插入路径/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
来对其进行整理:
https://www.howtogeek.com/118594/how-to-edit-your-system-path-for-easy-command-line-access/
但是当npm运行开始时,我又得到了这个错误:`users-Air:pdfuploader user $ npm运行开始
client@0.1.0开始/用户/用户/文档/ pdfuploader 反应脚本开始
找不到所需的文件。
名称:index.html
在以下位置搜索:/ Users / user / Documents / pdfuploader / public
npm ERR!代码ELIFECYCLE
npm ERR! errno 1
npm ERR! client@0.1.0开始:react-scripts start
npm ERR!退出状态1
npm ERR!
npm ERR!在client@0.1.0启动脚本处失败。
npm ERR! npm可能不是问题。上面可能还有其他日志记录输出。
npm错误!可以在以下位置找到此运行的完整日志: npm ERR! / Users / user / .npm / _logs / 2018-11-18T06_44_50_004Z-debug.log`
我试图npm运行的文件开始: https://github.com/damianjnc/pdfuploader
答案 0 :(得分:0)
一些nodeJS模块是用c ++编写的,在安装时需要进行编译。此过程需要安装python2。现在,大多数Mac实际上默认情况下都安装了python2,但是'python'可能尚未在您的可执行文件路径上。
在Mac上,python应用程序通常位于/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
。如果/System/Library/Frameworks/
中没有“ Python.framework”文件夹,则需要安装python。如果存在,则只需在/usr/bin
中符号链接前面提到的python2.7可执行文件。另外,通过在终端上键入/usr/bin
,确保可执行路径上存在echo $PATH
。
要创建符号链接,请运行:
cd /usr/bin
sudo ln -s /path/to/original/python python