我遇到了nodejs的问题。这是因为我试图从角度5迁移到6,但失败了。所以,我无法使用nodejs运行或构建我的项目。是否有任何解决方案可以帮助解决这个问题
当我尝试安装我的npm时运行以下命令:
npm install
我收到此错误:
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\js-yaml-cb078df5\dist\js-yaml.min.js'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\mime-f1f903d1\build\build.js'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\mime-f1f903d1\build\test.js'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\spdy-transport-91ae40ff\lib\spdy-transport\protocol\base\constants.js'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\spdy-transport-91ae40ff\lib\spdy-transport\protocol\base\framer.js'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\spdy-transport-91ae40ff\lib\spdy-transport\protocol\base\index.js'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\spdy-transport-91ae40ff\lib\spdy-transport\protocol\base\parser.js'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\spdy-transport-91ae40ff\lib\spdy-transport\protocol\base\scheduler.js'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\spdy-transport-91ae40ff\lib\spdy-transport\protocol\base\utils.js'
npm WARN tar ENOENT: no such file or directory, lstat 'F:\myapp\node_modules\.staging\clean-css-7b0fe6ee\lib\optimizer\level-2\properties'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-10-keyword.less'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-10-keyword.txt'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-11-operation.less'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-11-operation.txt'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-12-quoted.less'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-12-quoted.txt'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-13-selector.less'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-13-selector.txt'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-14-url.less'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-14-url.txt'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-15-value.less'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-15-value.txt'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-3-assignment.less'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-3-assignment.txt'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-4-call.less'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-4-call.txt'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-5-color-2.less'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-5-color-2.txt'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-5-color.less'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-5-color.txt'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-6-condition.less'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-6-condition.txt'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-7-dimension.less'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-7-dimension.txt'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-8-element.less'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-8-element.txt'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-9-expression.less'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\functions-9-expression.txt'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\import-malformed.less'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\import-malformed.txt'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\import-missing.less'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\import-missing.txt'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\import-no-semi.less'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\import-no-semi.txt'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\import-subfolder1.less'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\import-subfolder1.txt'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\import-subfolder2.less'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\less-c0c4bd4e\test\less\errors\import-subfolder2.txt'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\node-sass-f213465e\src\libsass\src\values.cpp'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\node-sass-f213465e\src\libsass\src\util.hpp'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\node-sass-f213465e\src\libsass\src\values.hpp'
npm WARN tar ENOENT: no such file or directory, open 'F:\myapp\node_modules\.staging\node-sass-f213465e\src\sass_types\value.h'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: right-align@0.1.3 (node_modules\right-align):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: Cannot cd into 'F:\myapp\node_modules\.staging\right-align-7384ea42'
npm ERR! code EINTEGRITY
npm ERR! sha1-If1bBZdltIyYI+Bc/kcMzdgW6LE= integrity checksum failed when using sha1: wanted sha1-If1bBZdltIyYI+Bc/kcMzdgW6LE= but got sha1-8FZUYK0JFXYydrTJV8KmuPo186I=. (111478 bytes)
npm WARN tar ENOENT: no such file or directory, lstat 'F:\myapp\node_modules\.staging\@angular\common-3ad65df7\esm2015\http\testing'
当我运行以下命令时:
npm start
我有另一个错误:
> myapp@0.0.0 start F:\myapp
> ng serve
Could not find module "@angular-devkit/build-angular" from "F:\\myapp".
Error: Could not find module "@angular-devkit/build-angular" from "F:\\myapp".
at Object.resolve (C:\Users\Kousic\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\core\node\resolve.js:141:11)
at Observable.rxjs_1.Observable [as _subscribe] (C:\Users\Kousic\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\architect\src\architect.js:132:40)
at Observable.subscribe (C:\Users\Kousic\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:162:69)
at DoOperator.call (C:\Users\Kousic\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\operators\tap.js:71:23)
at Observable.subscribe (C:\Users\Kousic\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:159:22)
at C:\Users\Kousic\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\util\subscribeTo.js:22:31
at Object.subscribeToResult (C:\Users\Kousic\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\util\subscribeToResult.js:7:45)
at MergeMapSubscriber._innerSub (C:\Users\Kousic\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:132:38)
at MergeMapSubscriber._tryNext (C:\Users\Kousic\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:129:14)
at MergeMapSubscriber._next (C:\Users\Kousic\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:112:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myapp@0.0.0 start: `ng serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myapp@0.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! C:\Users\Kousic\AppData\Roaming\npm-cache\_logs\2018-05-15T11_01_47_585Z-debug.log
这是我的package.json:
{
"name": "myapp",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^6.0.0",
"@angular/common": "^6.0.0",
"@angular/compiler": "^6.0.0",
"@angular/core": "^6.0.0",
"@angular/forms": "^6.0.0",
"@angular/http": "^6.0.0",
"@angular/platform-browser": "^6.0.0",
"@angular/platform-browser-dynamic": "^6.0.0",
"@angular/router": "^6.0.0",
"core-js": "^2.5.4",
"rxjs": "^6.0.0",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.6.1",
"@angular/cli": "~6.0.1",
"@angular/compiler-cli": "^6.0.0",
"@angular/language-service": "^6.0.0",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~1.4.2",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.3.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "~2.7.2"
}
}
答案 0 :(得分:2)
首先尝试:
npm cache clean --force
确保一切都一致。然后尝试
npm install --update-binary --no-shrinkwrap
在这些操作之后重新生成并对新版npm-shrinkwrap.json
进行版本化。
然后:删除package-lock.json
和npm i