最近,我从youtube视频中学习了ReactJS教程,链接:https://youtu.be/MhkGQAoc7bc?t=2m45s,当我在npm install
目录中运行1-basic-react
时遇到很多错误。在1-basic-react
目录中,已存在文件package.json
。
package.json
内的内容:
{
"name": "react-tutorials",
"version": "0.0.0",
"description": "",
"main": "webpack.config.js",
"dependencies": {
"babel-loader": "^6.2.0",
"babel-plugin-add-module-exports": "^0.1.2",
"babel-plugin-react-html-attrs": "^2.0.0",
"babel-plugin-transform-class-properties": "^6.3.13",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-preset-stage-0": "^6.3.13",
"react": "^0.14.6",
"react-dom": "^0.14.6",
"webpack": "^1.12.9",
"webpack-dev-server": "^1.14.1"
},
"devDependencies": {},
"scripts": {
"dev": "./node_modules/.bin/webpack-dev-server --content-base src --inline --hot",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
错误讯息:
unbuild babel-types@6.10.2
unbuild babel-helper-define-map@6.9.0
npm ERR! error rolling back Error: ENOTEMPTY, rmdir 'E:\Users\User\Documents\GitHub\react-js-tutorials\1-basic-react\nod
e_modules\babel-preset-es2015\node_modules\babel-plugin-transform-es2015-computed-properties\node_modules\babel-helper-d
efine-map\node_modules\babel-helper-function-name\node_modules\babel-traverse\node_modules\babylon\lib\tokenizer'
npm ERR! error rolling back babel-helper-define-map@6.9.0 { [Error: ENOTEMPTY, rmdir 'E:\Users\User\Documents\GitHub\re
act-js-tutorials\1-basic-react\node_modules\babel-preset-es2015\node_modules\babel-plugin-transform-es2015-computed-prop
erties\node_modules\babel-helper-define-map\node_modules\babel-helper-function-name\node_modules\babel-traverse\node_mod
ules\babylon\lib\tokenizer']
npm ERR! error rolling back errno: 53,
npm ERR! error rolling back code: 'ENOTEMPTY',
npm ERR! error rolling back path: 'E:\\Users\\User\\Documents\\GitHub\\react-js-tutorials\\1-basic-react\\node_modules
\\babel-preset-es2015\\node_modules\\babel-plugin-transform-es2015-computed-properties\\node_modules\\babel-helper-defin
e-map\\node_modules\\babel-helper-function-name\\node_modules\\babel-traverse\\node_modules\\babylon\\lib\\tokenizer' }
unbuild babel-template@6.9.0
unbuild babel-traverse@6.10.4
unbuild babel-helper-function-name@6.8.0
unbuild babel-runtime@6.9.2
npm WARN engine unicode-property-value-aliases@1.2.1: wanted: {"node":">=6"} (current: {"node":"v0.10.13","npm":"1.3.2"}
)
npm WARN engine unicode-property-aliases@1.1.0: wanted: {"node":">=6"} (current: {"node":"v0.10.13","npm":"1.3.2"})
npm ERR! Error: OK, write
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\
\npm-cli.js" "install"
npm ERR! cwd E:\Users\User\Documents\GitHub\react-js-tutorials\1-basic-react
npm ERR! node -v v0.10.13
npm ERR! npm -v 1.3.2
npm ERR! code OK
npm ERR! Error: OK, close
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\
\npm-cli.js" "install"
npm ERR! cwd E:\Users\User\Documents\GitHub\react-js-tutorials\1-basic-react
npm ERR! node -v v0.10.13
npm ERR! npm -v 1.3.2
npm ERR! code OK
npm ERR! Error: ENOENT, chmod 'E:\Users\User\Documents\GitHub\react-js-tutorials\1-basic-react\node_modules\babel-preset
-es2015\node_modules\babel-plugin-transform-es2015-object-super\node_modules\babel-runtime\node_modules\core-js\library\
modules\core.regexp.escape.js'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\
\npm-cli.js" "install"
npm ERR! cwd E:\Users\User\Documents\GitHub\react-js-tutorials\1-basic-react
npm ERR! node -v v0.10.13
npm ERR! npm -v 1.3.2
npm ERR! path E:\Users\User\Documents\GitHub\react-js-tutorials\1-basic-react\node_modules\babel-preset-es2015\node_modu
les\babel-plugin-transform-es2015-object-super\node_modules\babel-runtime\node_modules\core-js\library\modules\core.rege
xp.escape.js
npm ERR! fstream_path E:\Users\User\Documents\GitHub\react-js-tutorials\1-basic-react\node_modules\babel-preset-es2015\n
ode_modules\babel-plugin-transform-es2015-object-super\node_modules\babel-runtime\node_modules\core-js\library\modules\c
ore.regexp.escape.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call chmod
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\fstream\lib\writer.js:305:19
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! tar pack Error reading C:\Users\Casper\AppData\Local\Temp\npm-2516\1466863728585-0.9564304898958653\package
npm ERR! tar pack Error reading C:\Users\Casper\AppData\Local\Temp\npm-2516\1466863728585-0.9564304898958653\package
npm ERR! addLocalDirectory Could not pack "C:\\Users\\Casper\\AppData\\Local\\Temp\\npm-2516\\1466863728585-0.9564304898
958653\\package" to "C:\\Users\\Casper\\AppData\\Roaming\\npm-cache\\babel-messages\\6.8.0\\package.tgz"
npm ERR! addLocalDirectory Could not pack "C:\\Users\\Casper\\AppData\\Local\\Temp\\npm-2516\\1466863728585-0.9564304898
958653\\package" to "C:\\Users\\Casper\\AppData\\Roaming\\npm-cache\\babel-messages\\6.8.0\\package.tgz"
unbuild babel-traverse@6.10.4
unbuild babel-template@6.9.0
unbuild babel-types@6.10.2
npm ERR! error rolling back Error: ENOTEMPTY, rmdir 'E:\Users\User\Documents\GitHub\react-js-tutorials\1-basic-react\nod
e_modules\babel-preset-stage-0\node_modules\babel-preset-stage-1\node_modules\babel-plugin-transform-class-constructor-c
all\node_modules\babel-runtime\node_modules\core-js\modules'
npm ERR! error rolling back babel-plugin-transform-class-constructor-call@6.8.0 { [Error: ENOTEMPTY, rmdir 'E:\Users\Us
er\Documents\GitHub\react-js-tutorials\1-basic-react\node_modules\babel-preset-stage-0\node_modules\babel-preset-stage-1
\node_modules\babel-plugin-transform-class-constructor-call\node_modules\babel-runtime\node_modules\core-js\modules']
npm ERR! error rolling back errno: 53,
npm ERR! error rolling back code: 'ENOTEMPTY',
npm ERR! error rolling back path: 'E:\\Users\\User\\Documents\\GitHub\\react-js-tutorials\\1-basic-react\\node_modules
\\babel-preset-stage-0\\node_modules\\babel-preset-stage-1\\node_modules\\babel-plugin-transform-class-constructor-call\
\node_modules\\babel-runtime\\node_modules\\core-js\\modules' }
unbuild babel-runtime@6.9.2
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! E:\Users\User\Documents\GitHub\react-js-tutorials\1-basic-react\npm-debug.log
npm ERR! not ok code 0
答案 0 :(得分:1)
根据您的评论,您遇到了某种PATH问题。在命令行中,您可以键入echo %PATH%
并查找指向节点目录的多个条目。
您需要编辑路径,以便只有具有最新节点副本的目录。其他Stack网站上有instructions for doing this on Windows 7。
有一点需要注意:如果您已经安装了全局模块,那么它们很可能位于v0.10.13目录树中。在使用npm ls -g --depth=0
更改任何内容之前记下它们,因为在修复路径问题后,您可能需要重新安装这些全局模块。