为什么我会收到elifecycle错误编号1

时间:2018-10-28 01:22:57

标签: node.js sass npm-scripts

嗨,我正在尝试在个人档案夹上运行和使用sass,但是当我尝试使用npm run sass命令时,出现此错误

'node-sass' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! anthonymannportfolio@1.0.0 sass: `node-sass -w scss/ -o dist/css/ --recursive`
npm ERR! Exit status 1

具有以下调试信息

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'sass' ]
2 info using npm@6.4.1
3 info using node@v11.0.0
4 verbose run-script [ 'presass', 'sass', 'postsass' ]
5 info lifecycle anthonymannportfolio@1.0.0~presass: anthonymannportfolio@1.0.0
6 info lifecycle anthonymannportfolio@1.0.0~sass: anthonymannportfolio@1.0.0
7 verbose lifecycle anthonymannportfolio@1.0.0~sass: unsafe-perm in lifecycle true
8 verbose lifecycle anthonymannportfolio@1.0.0~sass: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\antho\Documents\Anthony\AnthonyMannPortfolio\node_modules\.bin;C:\ProgramData\Boxstarter;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\nodejs\;C:\Program Files\Microsoft VS Code\bin;C:\ProgramData\chocolatey\bin;C:\Users\antho\AppData\Local\Microsoft\WindowsApps;C:\Users\antho\AppData\Local\atom\bin;C:\Program Files\Microsoft VS Code\bin;C:\Users\antho\AppData\Local\Microsoft\WindowsApps;C:\Users\antho\AppData\Roaming\npm
9 verbose lifecycle anthonymannportfolio@1.0.0~sass: CWD: C:\Users\antho\Documents\Anthony\AnthonyMannPortfolio
10 silly lifecycle anthonymannportfolio@1.0.0~sass: Args: [ '/d /s /c', 'node-sass -w scss/ -o dist/css/ --recursive' ]
11 silly lifecycle anthonymannportfolio@1.0.0~sass: Returned: code: 1  signal: null
12 info lifecycle anthonymannportfolio@1.0.0~sass: Failed to exec sass script
13 verbose stack Error: anthonymannportfolio@1.0.0 sass: `node-sass -w scss/ -o dist/css/ --recursive`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:182:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:182:13)
13 verbose stack     at maybeClose (internal/child_process.js:962:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid anthonymannportfolio@1.0.0
15 verbose cwd C:\Users\antho\Documents\Anthony\AnthonyMannPortfolio
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "sass"
18 verbose node v11.0.0
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error anthonymannportfolio@1.0.0 sass: `node-sass -w scss/ -o dist/css/ --recursive`
22 error Exit status 1
23 error Failed at the anthonymannportfolio@1.0.0 sass script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

我刚接触Node.js和sass,因为我正尝试观看Brad Traversy的youtube视频,但这些错误使我无法继续前进。对于解决此问题的任何帮助将不胜感激。

2 个答案:

答案 0 :(得分:0)

请尝试卸载依赖项,尤其是在使用守望者时。然后删除node_modules文件,如果该文件存在,也删除package-lock.jsonrm -rf node_modules package-lock.json

重新安装依赖项,然后安装监视程序npm watchman

如果还使用yarn,请运行{p>

必要时链接

“ npm安装”

答案 1 :(得分:0)

我尝试了所有操作,清理了缓存,删除了node_module,删除了package.json,然后再次运行了npm install,但是没有任何效果。完成之后,我重新启动计算机并运行sudo npm start,它可以正常工作。