运行 npm build 时找不到 Parcel 命令

new*_*per 6 node.js

我正在尝试为 openlayers 创建一个捆绑包。我已按照教程https://openlayers.org/en/latest/doc/tutorials/bundle.html进行操作,当我到达时,npm run build出现以下错误。

\n\n
openmap@1.0.0 build /accounts/linuxuser/web_projects/openmap\nparcel build --public-url . index.html\nsh: parcel: command not found\n
Run Code Online (Sandbox Code Playgroud)\n\n

当我进入lsnode_modules文件夹时,我得到了。parcel -> ../parcel-bundler/bin/cli.js。\n当我cd进入node_modules文件夹时,找不到parcel-bundler文件夹。当我跑步时,npm install --save-dev parcel-bundler 我得到以下信息。

\n\n
  deasync@0.1.15 install /accounts/linuxuser/web_projects/openmap/node_modules/deasync\n  node ./build.js\n  sh: node: command not found\n  openmap@1.0.0 /accounts/linuxuser/web_projects/openmap\n
Run Code Online (Sandbox Code Playgroud)\n\n

我确实有 npm 安装。

\n\n
npm --version\n3.5.2\n
Run Code Online (Sandbox Code Playgroud)\n\n

运行后出错npm install --save-dev parcel-bundler

\n\n
 WARN engine parcel-bundler@1.12.3: wanted: {"node":">= 6.0.0"} (current: {"node":"4.2.6","npm":"3.5.2"})\n\n deasync@0.1.15 install /accounts/linuxuser/web_projects/openmap/node_modules/deasync\n node ./build.js\n\n sh: node: command not found\n openmap@1.0.0 /accounts/linuxuser/web_projects/openmap\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 ol@5.3.3  extraneous\n\n npm WARN optional Skipping failed optional dependency /chokidar/fsevents:\n npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.2.9\n npm WARN openmap@1.0.0 No description\n npm WARN openmap@1.0.0 No repository field.\n npm ERR! Linux 4.4.0-154-generic\n npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "--save-dev" "parcel-bundler"\n npm ERR! node v4.2.6\n npm ERR! npm  v3.5.2\n npm ERR! file sh\n npm ERR! code ELIFECYCLE\n npm ERR! errno ENOENT\n npm ERR! syscall spawn\n\n npm ERR! deasync@0.1.15 install: `node ./build.js`\n npm ERR! spawn ENOENT\n npm ERR! \n npm ERR! Failed at the deasync@0.1.15 install script \'node ./build.js\'.\n\n pm ERR! Make sure you have the latest version of node.js and npm installed.\n npm ERR! If you do, this is most likely a problem with the deasync package,\n npm ERR! not with npm itself.\n npm ERR! Tell the author that this fails on your system:\n npm ERR!     node ./build.js\n npm ERR! You can get information on how to open an issue for this project with:\n npm ERR!     npm bugs deasync\n npm ERR! Or if that isn\'t available, you can get their info via:\n npm ERR!     npm owner ls deasync\n npm ERR! There is likely additional logging output above.\n\n npm ERR! Please include the following file with any support request:\n npm ERR!     /accounts/linuxuser/web_projects/openmap/npm-debug.log\n
Run Code Online (Sandbox Code Playgroud)\n\n

文件夹结构是

\n\n
   openmap/\n       index.html\n       index.js\n       package.json\n       node_modules/\n
Run Code Online (Sandbox Code Playgroud)\n

Jul*_* DC 2

就我而言,我错误地运行了它,应该使用以下命令之一运行它:

npx parcel ...
yarn parcel ...
Run Code Online (Sandbox Code Playgroud)