尝试在新笔记本电脑上运行json脚本时出现npm错误

时间:2019-03-03 20:00:38

标签: node.js npm

我参加了有关编码的在线课程,其中包括一些小脚本来编译我的sass和concat我的css文件。最近,我买了一台新笔记本电脑,并安装了节点,安装了依赖项,但由于某种原因,我无法使它们中的任何一个起作用。

这是我所做的:

已安装的节点(当前版本:v10.15.2)

npm已安装并: * sudo npm install live-server -g * npm安装自动前缀--save-dev * npm安装postcss-cli --save-dev

这是我的json脚本:

"scripts": { "watch:sass": "node-sass sass/main.scss css/style.css -w", "devserver": "live-server", "start": "npm-run-all --parallel devserver watch:sass", "compile:sass": "node-sass sass/main.scss css/style.comp.css", "concat:css": "concat -o css/style.concat.css css/icon-font.css css/style.comp.css", "prefix:css": "postcss --use autoprefixer -b 'last 10 versions' css/style.concat.css -o css/style.prefix.css", "compress:css": "node-sass css/style.prefix.css css/style.css --output-style compressed", "build:css": "npm-run-all compile:sass concat:css prefix:css compress:css" },

这是我的错误:

`    npm start

> talentsfestivals@1.0.0 start /Users/vasil.krumov/Documents/Projects/TalentsFestivals
> npm-run-all --parallel devserver watch:sass

internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module '../common/bootstrap'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/Users/vasil.krumov/Documents/Projects/TalentsFestivals/node_modules/.bin/npm-run-all:13:1)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! talentsfestivals@1.0.0 start: `npm-run-all --parallel devserver watch:sass`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the talentsfestivals@1.0.0 start 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/vasil.krumov/.npm/_logs/2019-03-03T15_29_19_750Z-debug.log `

有人可以帮助我吗?

非常感谢!

1 个答案:

答案 0 :(得分:0)

为了其他人寻找您的问题的解决方案,我将在此处编写它以便于查找。 第一个问题似乎是一些旧模块,要清理它,请删除您的modules文件夹,然后再次安装npm。 下一个问题似乎是EACCES权限错误。通常,您不想sudo安装npm软件包。如果您有EACCES权限错误,请查看此documentation