首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >运行npm build时找不到Parcel命令

运行npm build时找不到Parcel命令
EN

Stack Overflow用户
提问于 2019-08-20 21:50:33
回答 1查看 5.5K关注 0票数 3

我正在尝试为openlayer创建一个包。我已经按照教程https://openlayers.org/en/latest/doc/tutorials/bundle.html操作了,当我进入npm run build时,我得到了以下错误。

代码语言:javascript
复制
openmap@1.0.0 build /accounts/linuxuser/web_projects/openmap
parcel build --public-url . index.html
sh: parcel: command not found

当我ls node_modules文件夹时,我得到了。parcel -> ../parcel-bundler/bin/cli.js。当我cd到node_modules文件夹时,找不到parcel-bundler文件夹。当我运行npm install --save-dev parcel-bundler时,我得到了以下结果。

代码语言:javascript
复制
  deasync@0.1.15 install /accounts/linuxuser/web_projects/openmap/node_modules/deasync
  node ./build.js
  sh: node: command not found
  openmap@1.0.0 /accounts/linuxuser/web_projects/openmap

我确实安装了npm。

代码语言:javascript
复制
npm --version
3.5.2

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

代码语言:javascript
复制
 WARN engine parcel-bundler@1.12.3: wanted: {"node":">= 6.0.0"} (current: {"node":"4.2.6","npm":"3.5.2"})

 deasync@0.1.15 install /accounts/linuxuser/web_projects/openmap/node_modules/deasync
 node ./build.js

 sh: node: command not found
 openmap@1.0.0 /accounts/linuxuser/web_projects/openmap
 └── ol@5.3.3  extraneous

 npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
 npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.2.9
 npm WARN openmap@1.0.0 No description
 npm WARN openmap@1.0.0 No repository field.
 npm ERR! Linux 4.4.0-154-generic
 npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "--save-dev" "parcel-bundler"
 npm ERR! node v4.2.6
 npm ERR! npm  v3.5.2
 npm ERR! file sh
 npm ERR! code ELIFECYCLE
 npm ERR! errno ENOENT
 npm ERR! syscall spawn

 npm ERR! deasync@0.1.15 install: `node ./build.js`
 npm ERR! spawn ENOENT
 npm ERR! 
 npm ERR! Failed at the deasync@0.1.15 install script 'node ./build.js'.

 pm ERR! Make sure you have the latest version of node.js and npm installed.
 npm ERR! If you do, this is most likely a problem with the deasync package,
 npm ERR! not with npm itself.
 npm ERR! Tell the author that this fails on your system:
 npm ERR!     node ./build.js
 npm ERR! You can get information on how to open an issue for this project with:
 npm ERR!     npm bugs deasync
 npm ERR! Or if that isn't available, you can get their info via:
 npm ERR!     npm owner ls deasync
 npm ERR! There is likely additional logging output above.

 npm ERR! Please include the following file with any support request:
 npm ERR!     /accounts/linuxuser/web_projects/openmap/npm-debug.log

文件夹结构为

代码语言:javascript
复制
   openmap/
       index.html
       index.js
       package.json
       node_modules/
EN

回答 1

Stack Overflow用户

发布于 2021-07-18 20:01:14

在我的例子中,我错误地运行了它,它被认为是使用以下命令之一运行的:

代码语言:javascript
复制
npx parcel ...
yarn parcel ...
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57575205

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档